// use std::collections::HashSet;

use serde::Deserialize;
use serde_aux::field_attributes::deserialize_number_from_string;
use url::{ParseError, Url};

#[derive(Debug, Deserialize)]
pub struct ProviderSettings {
    host: String,
    #[serde(deserialize_with = "deserialize_number_from_string")]
    port: u16,
    // #[serde(default)]
    // blacklist: HashSet<String>,
}

impl ProviderSettings {
    pub fn ws_url(&self) -> Result<Url, ParseError> {
        Url::parse(&format!("ws://{}:{}", self.host, self.port))
    }

    // pub fn is_unsupported(&self, code: &str) -> bool {
    //     self.blacklist.contains(code)
    // }
}